Skip to content

docs: harden Xtend-to-Java migration fidelity rules - #1473

Open
joaodinissf wants to merge 1 commit into
dsldevkit:masterfrom
joaodinissf:docs/xtend-skill-operator-add-and-exceptions
Open

docs: harden Xtend-to-Java migration fidelity rules#1473
joaodinissf wants to merge 1 commit into
dsldevkit:masterfrom
joaodinissf:docs/xtend-skill-operator-add-and-exceptions

Conversation

@joaodinissf

@joaodinissf joaodinissf commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

What

Hardens .agents/skills/xtend-to-java with migration-fidelity rules verified against Xtext 2.43.0, fresh xtend-gen, and current repository migrations.

Rules and fixes

  • Preserve both JvmTypesBuilder.operator_add null-skipping overloads at inferrer EList += sites; nullable builders and helpers require guards or Objects::nonNull.
  • Preserve IterableExtensions.toSet encounter order with LinkedHashSet, and check whether its return-existing-Set aliasing is observable.
  • Preserve Xtend checked-exception signatures and throwable identity without copying compiler scaffolding. Keep explicit catches specific; catch only the narrow checked types Java requires and use Exceptions.sneakyThrow when one must escape undeclared. Do not catch Throwable, Exception, or RuntimeException merely to imitate xtend-gen; a broad catch is allowed only when the invoked API declares that type and no narrower form compiles.
  • Choose charsets from the data contract. Use Eclipse file metadata or UTF-8 for repository-owned UTF-8 text; do not guess UTF-8 for opaque external bytes.
  • Align the quick reference, validation checklist, known pitfalls, and worked example; replace stale line-number references with stable method references.

Why

The operator_add rule prevents the regression fixed in #1474: FormatJvmModelInferrer.inferConstants used a bare EList.add for a nullable producer and threw where Xtend skipped null. The ordered-set rule protects generator output in the remaining Wave 4 scope/export migrations.

Validation

  • git diff --check
  • all relative Markdown links resolve
  • Xtext 2.43.0 source, bytecode, and compiler assertions reviewed
  • mvn -f ./ddk-parent/pom.xml -pl :com.avaloq.tools.ddk.xtext.scope -am -DskipTests -T 1 compile --batch-modeBUILD SUCCESS

Skill-only Markdown change; no production or build-configuration changes.

@joaodinissf
joaodinissf force-pushed the docs/xtend-skill-operator-add-and-exceptions branch from 627637c to 0b8d690 Compare August 10, 2026 22:46
@joaodinissf
joaodinissf force-pushed the docs/xtend-skill-operator-add-and-exceptions branch from 0b8d690 to 5d5348d Compare August 26, 2026 09:39
@joaodinissf joaodinissf changed the title docs: encode operator_add null-skip, exception lowering, and charset rules in xtend-to-java skill docs: harden Xtend-to-Java migration fidelity rules Aug 26, 2026
@joaodinissf
joaodinissf marked this pull request as ready for review August 26, 2026 09:51
@joaodinissf
joaodinissf enabled auto-merge (rebase) August 26, 2026 09:52
- [ ] All comments and class/member Javadoc preserved exactly.
- [ ] Copyright header is the exact Avaloq banner — **replacing** any generated-stub or Javadoc-style header the source had (not preserved from source).
- [ ] Checked exceptions handled (`throws` clause or `try`/`catch` with specific types).
- [ ] Checked exceptions preserve the original signature and throwable identity using only narrow catches; `Exceptions.sneakyThrow` is used where required.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not use Exceptions.sneakyThrow

@joaodinissf
joaodinissf force-pushed the docs/xtend-skill-operator-add-and-exceptions branch from 5d5348d to 5f7da05 Compare August 26, 2026 12:03
Encode the migration traps verified against Xtext 2.43.0 and current repository code.

Preserve both JvmTypesBuilder.operator_add null-skipping overloads and document nullable builder results. Preserve IterableExtensions.toSet encounter order and observable Set aliasing.

Define explicit checked-exception contracts without copying generated exception-handling scaffolding. Choose charsets from a verified data contract instead of guessing from source encoding.

Align the quick reference, validation checklist, pitfalls, and worked example with those rules.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@joaodinissf
joaodinissf force-pushed the docs/xtend-skill-operator-add-and-exceptions branch from 5f7da05 to 802f769 Compare August 26, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants